<?php if (!defined('SERVER_ROOT')) exit('No direct script access allowed');

class phucaptrachnhiem_Controller extends Controller {

    function __construct(){
        parent::__construct('quanlyluong', 'phucaptrachnhiem');
        $this->check_login();
        $this->view->template->menu_html =$this->CREATE_MENU();
        $this->view->template->nhacviec_html =$this->CREATE_NHAC_VIEC(); 
        $this->CHECK_QUYEN('quanlyluong', 'phucaptrachnhiem');
    }

    function main(){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $this->dsp_all_phucaptrachnhiem();
    }
    function dsp_all_phucaptrachnhiem(){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $VIEW_DATA['arr_all_phucaptrachnhiem']     = $this->model->qry_all_phucaptrachnhiem();
        $this->view->render('dsp_all_phucaptrachnhiem', $VIEW_DATA);
    }
    public function dsp_single_phucaptrachnhiem($MA_PHU_CAP_TRACH_NHIEM){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $MA_PHU_CAP_TRACH_NHIEM = replace_bad_char($MA_PHU_CAP_TRACH_NHIEM);
        $VIEW_DATA['arr_single_phucaptrachnhiem'] = $this->model->qry_single_phucaptrachnhiem($MA_PHU_CAP_TRACH_NHIEM);
        $VIEW_DATA['arr_all_chucvu'] = $this->model->SELECT_CHUCVU_nothing();
        $this->view->render('dsp_single_phucaptrachnhiem', $VIEW_DATA);
    }
    public function update_phucaptrachnhiem(){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $this->model->goback_url = $this->view->get_controller_url() . 'dsp_all_phucaptrachnhiem';
        $this->model->update_phucaptrachnhiem();
    }
    public function delete_phucaptrachnhiem(){
        (Session::get(TIEP_DAU_NGU_SESSION.'QUAN_TRI') == 1) Or die($this->access_denied());
        $this->model->goback_url = $this->view->get_controller_url() . 'dsp_all_phucaptrachnhiem';
        $this->model->delete_phucaptrachnhiem();
    }
}